<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="bootstarp/css/bootstrap.min.css">
    <script src="bootstarp/js/bootstrap.min.js"></script>
    <script src=bootstarp/js/jquery-1.12.2.js"></script>
    <style>
        #div1{
            width:300px;
            border:1px solid black;
            height:240px;
 
        }
    </style>
</head>
<body>
<div id="div1">
    <h1 style="text-align: center;color:#ff8d40">购物网登录页面</h1>
    <form onsubmit="return chk()" action="load2.php" style="margin-top: 40px;margin-left: 20px;" method="post">
        <span>用户名：</span>
        <input type="text" name="username" id="un"/><br/><br/>
        <span style="letter-spacing: 1em">密</span>码：
        <input type="password" name="psw" id="psw">
        <br/><br/>
        <input type="submit" style="margin-left: 178px"/>
        </form>
    <div id="errinfo" style="color:red;">
    </div>
</div>
<script>
    function chk(){
       var myform=document.getElementById("un");
        var psw=document.getElementById("psw");
            if(myform.value==''){
               document.getElementById(("errinfo")).innerHTML='必须有用户名';
                return false;
            }else{
                if(psw.value==''){
                    document.getElementById(("errinfo")).innerHTML='必须有密码';
                    return false;
                }else{
                    return true;
                }
            }
    }
</script>
</body>
</html>